/**
 * Initialize the different behaviors on Fox and apps
 */
/* Zoom To Hide Address Bar on Iphone*/

var App = {};

//addEventListener not working in ie8
if (!window.addEventListener) {
	window.attachEvent("load", function() {setTimeout(function(){window.scrollTo(0, 1);}, 0);});
}
else {
	window.addEventListener("load",function() {setTimeout(function(){window.scrollTo(0, 1);}, 0);});    
}

function initializeBehaviors(element) {
	setTimeout(function () {
		doInitializeBehaviors(element);
	}, 1);
}

function doInitializeBehaviors(element) {
	var $element = $(element);
     //   alert($(window).width());
    App = new Fx.Application($element,{'init':'all','translation':{'src':'local','active':true}});
	
	$element.find('input.trackchanges').change(function()
	{
		$(this).closest("tr").addClass("changed");
	});
	
	var $focusable = $element.find('input.focus');
	$focusable.add('select.focus', $element)
		.add('textarea.focus', $element);
	$focusable.filter(":enabled:visible:first").focus();

	// Initialize help buttons
	$element.find('img.helpButton').each(function(){
		$(this).tipTip({defaultPosition: "top", maxWidth: "500px"});
	});
}
/**
 * Initialize the behavior of element
 */
$(function(){
	initializeBehaviors(document);
});
